# frozen_string_literal: true

class CreateRuleSchemas < ActiveRecord::Migration[6.0]
  def change
    create_table :rule_schemas do |t|
      t.integer :rule_entity_id,  null: false,  limit: 8
      t.integer :schema_id,       null: false,  limit: 8
      t.timestamps                null: false
    end

    add_index :rule_schemas, %i[rule_entity_id schema_id], unique: true
    add_foreign_key :rule_schemas, :rule_entities
    add_foreign_key :rule_schemas, :schemas
  end
end
